#!/usr/bin/python

import urllib2
import urllib

# get
if False:
	response=urllib2.urlopen("http://www.baidu.com");
	html=response.read();
	print html

# post
if True:
	values={"name":"abc"};
	user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
	headers = { 'User-Agent' : user_agent }
	pdata=urllib.urlencode(values);
	req=urllib2.Request("http://www.baidu.com",pdata,headers);
	res=urllib2.urlopen(req);
	html=res.read();
	print html
